home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload Trio 2
/
Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO
/
dir36
/
tsbat46.zip
/
TOUCH.BAT
< prev
next >
Wrap
DOS Batch File
|
1992-10-25
|
2KB
|
56 lines
@echo off
echo off
echo ┌─────────────────────────────────────────────┐
echo │ Touch a file's datetime stamp │
echo │ by Prof. Timo Salmi, ts@uwasa.fi, 25-Oct-92 │
echo └─────────────────────────────────────────────┘
echo.
if "%1"=="" goto _help
if not exist %1 goto _notfound
rem Chech that a path has not been included in the filename
echo @echo off> tmp$$$.bat
echo set rest_=%%1>> tmp$$$.bat
echo :_next>> tmp$$$.bat
echo set prev_=%%rest_%%>> tmp$$$.bat
echo for %%%%g in (/%%rest_%%) do set rest_=%%%%g>> tmp$$$.bat
echo if ":%%rest_%%"=="%%prev_%%" goto _found>> tmp$$$.bat
echo if "\%%rest_%%"=="%%prev_%%" goto _found>> tmp$$$.bat
echo if not "%%rest_%%"=="%%prev_%%" goto _next>> tmp$$$.bat
echo goto _nopath>> tmp$$$.bat
echo :_found>> tmp$$$.bat
echo set haspath_=yes>> tmp$$$.bat
echo goto _out>> tmp$$$.bat
echo :_nopath>> tmp$$$.bat
echo set haspath_=no>> tmp$$$.bat
echo :_out>> tmp$$$.bat
echo set rest_=>> tmp$$$.bat
echo set prev_=>> tmp$$$.bat
for %%f in (%1) do call tmp$$$ %%f
if exist tmp$$$.bat del tmp$$$.bat
if not "%haspath_%"=="yes" goto _touch
rem Illegal file name with a path
echo The filename %1 must not include a path
goto _out
rem Display the directory and touch the file
:_touch
dir %1
for %%f in (%1) do copy /b /v %%f +,,> nul
dir %1
goto _out
:_notfound
echo File %1 not found
goto _out
:_help
echo Usage: TOUCH [FileName]
echo No paths, just the filename
echo.
:_out
set haspath_=